﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using BDD.TicTacToe.Domain;
using BDD.TicTacToe.Ui.Mvc.Models;
using MvcContrib.TestHelper;
using NUnit.Framework;
using Rhino.Mocks;

namespace BDD.TicTacToe.Core.Tests.Controller_Specs
{
    [TestFixture]
    public class When_asking_for_a_new_game_to_be_created : with_given_MenuController
    {
        private NewGameViewModel _newGameRequest;
        private ActionResult _result;

        [SetUp]
        public void When()
        {
            _newGameRequest = new NewGameViewModel()
                                  {
                                      PlayerXName = "Scott",
                                      PlayerOName = "Simon"
                                  };

           _result =  Sut.Index(_newGameRequest);
        }

        [Test]
        public void Then_the_controller_should_create_a_new_game_and_save_in_repository()
        {
            GameRepository.AssertWasCalled(x => x.Add(Arg<Game>.Is.Anything)); 
        }

        [Test]
        public void Then_the_controller_should_return_a_redirect_action()
        {
            _result.AssertResultIs<RedirectToRouteResult>();
        }

        [Test]
        public void Then_the_controller_should_return_a_redirect_action_to_the_game_page()
        {
            Assert.Fail();
        }

        [Test]
        public void Then_the_controller_should_return_a_redirect_action_with_a_game_id_value()
        {
            Assert.Fail();
        }
    }
}
